﻿using System;
using System.Text.RegularExpressions;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.HttpApiGateway.Interface;
using WeDonekRpc.HttpService.Collect;

namespace WeDonekRpc.HttpApiGateway.Service
{
    [ClassLifetimeAttr(ClassLifetimeType.SingleInstance)]
    internal class UrlRewriteService : IUrlRewriteService
    {
        public void Remove (string path)
        {
            UrlRewriteCollect.Remove(path);
        }
        public void Remove (Regex regex)
        {
            UrlRewriteCollect.Remove(regex);
        }
        public void Add (string path, string endPoint)
        {
            UrlRewriteCollect.Add(path, endPoint);
        }
        public void Add (Regex regex, string endPoint)
        {
            UrlRewriteCollect.Add(regex, endPoint);
        }
        public void Add (string path, Func<Uri, string> filter)
        {
            UrlRewriteCollect.Add(path, filter);
        }
        public void Add (Regex regex, Func<Uri, string> filter)
        {
            UrlRewriteCollect.Add(regex, filter);
        }
    }
}
